Hi,
Is there a way to create a trigger on deletion of objects?? I am tring to send an e-mail everytime an object is changed, inserted or deleted in a module. I have completed the "changing of object text or heading" and "inserting new object" parts but I have no idea about the deleting an object part. I think none of the object attributes is changed when the object is deleted, so I cannot use the attribute triggers. I am tring to get some information from the object history but no progress so far..
Thanks,
Cigdem
cidem - Tue Dec 29 06:52:36 EST 2009 |
|
Re: Is there a trigger on deletion of objects in a module? Mathias Mamsch - Tue Dec 29 12:58:25 EST 2009
As far as I know there is no reliable way to hook object creation, object deletion or link creation/deletion. It seems that Telelogic wanted to implement them but they probably never found the time since Version 7 or earlier.
There are ways to use the "Sync" event trigger or the "Close module" event trigger on a and look at the history but all the ways I tried so far are not 100% reliable.
Regards, Mathias
|
|
Re: Is there a trigger on deletion of objects in a module? cidem - Mon Jan 04 06:19:57 EST 2010 Mathias Mamsch - Tue Dec 29 12:58:25 EST 2009
As far as I know there is no reliable way to hook object creation, object deletion or link creation/deletion. It seems that Telelogic wanted to implement them but they probably never found the time since Version 7 or earlier.
There are ways to use the "Sync" event trigger or the "Close module" event trigger on a and look at the history but all the ways I tried so far are not 100% reliable.
Regards, Mathias
Thanks for the quick reply. Now I am working on history of the objects but I haven't been successful yet. I think I have to search for the HistoryType==deleteObject cases in the "last" history record while closing the module. Do you know how I can access the latest record in the history? (I mean the changes I have done before closing the module)
|
|
Re: Is there a trigger on deletion of objects in a module? SudarshanRao - Mon Jan 04 09:53:54 EST 2010
I guess the best option is to first loop through the history sessions to identify the last session and then check for history records in that last session for HistoryType deleteObject/purgeObject..
For eg.,
==================================
HistorySession hs
History h
int sessNo, lastNo
for hs in current Module do
{}
lastNo = number hs
lastNo++
for h in current Module do
{
sessNo = h.sessionNo
if(sessNo == lastNo)
{
print h.author "\t" h.date "\t" h.type "\n"
//Do the manipulation with h.type here..
}
}
print "Done"
==================================
But with growing history, this would hit on performance..
cheers,
Sudarshan
|
|
Re: Is there a trigger on deletion of objects in a module? roybond - Fri Jan 08 03:08:46 EST 2010
You CAN get DOORS to reacte to the deletion of an Object, if you have deleted Objects visible in the View (by setting 'View','Show','Deletions' in the Formal Module menu).
I have a DXL Attribute which simply contains "isDeleted(obj)" which is then set TRUE when a user hits the Delete Key on the current Object, which in turn fires a Trigger.
In my case, I use the Trigger to then undelete the Object, and then set a Status Attribute to "DELETED" (which is only one of the possible enumerations, eg. DRAFT, REVIEW, etc.)
In this way, I can then more accurately (and easily) report on the status of all Objects in the Module.
Have fun,
Roy.
email: roy.bond@baesystems.com
|
|
Re: Is there a trigger on deletion of objects in a module? llandale - Fri Jan 08 11:52:17 EST 2010 roybond - Fri Jan 08 03:08:46 EST 2010
You CAN get DOORS to reacte to the deletion of an Object, if you have deleted Objects visible in the View (by setting 'View','Show','Deletions' in the Formal Module menu).
I have a DXL Attribute which simply contains "isDeleted(obj)" which is then set TRUE when a user hits the Delete Key on the current Object, which in turn fires a Trigger.
In my case, I use the Trigger to then undelete the Object, and then set a Status Attribute to "DELETED" (which is only one of the possible enumerations, eg. DRAFT, REVIEW, etc.)
In this way, I can then more accurately (and easily) report on the status of all Objects in the Module.
Have fun,
Roy.
email: roy.bond@baesystems.com
I cannot visualize your implementation. You have an attrDXL that sets True when the object is deleted, but doesn't set itself to False? You also have a pre-attr-save trigger on your dxlAttr which detects a Not'Deleted'-to-Yes'Deleted' value change? Why would the dxlAttr fire when you delete an object? Why not have the dxlAttr do the undelete directly?
|
|
Re: Is there a trigger on deletion of objects in a module? cidem - Fri Jan 08 13:33:09 EST 2010 SudarshanRao - Mon Jan 04 09:53:54 EST 2010
I guess the best option is to first loop through the history sessions to identify the last session and then check for history records in that last session for HistoryType deleteObject/purgeObject..
For eg.,
==================================
HistorySession hs
History h
int sessNo, lastNo
for hs in current Module do
{}
lastNo = number hs
lastNo++
for h in current Module do
{
sessNo = h.sessionNo
if(sessNo == lastNo)
{
print h.author "\t" h.date "\t" h.type "\n"
//Do the manipulation with h.type here..
}
}
print "Done"
==================================
But with growing history, this would hit on performance..
cheers,
Sudarshan
First of all thanks to everyone...
Sudarshan, your suggestion was very helpful to me. My dxl is now checking the latest history session and writing the modify, delete and create object records to a text file. It has failed once but I could not find the reason, I am searching for it. The only problem left is, I did not want the records of modifying the other attributes (just need the object heading and text but they are also written as "modifyObject" type of history to the text file. I thought their history type was "modifyAttr", but I guess I was wrong. I will be working on that.
Roy, your suggestion is also worth trying I think, the problem is there are other users, and I can not control if they set show-> deletions checked all the time. My main reason for writing this dxl is to write the modified/deleted/created objects to a file when other users change a module and e-mail them to me.
You all have been vey helpful, thanks again.
Cigdem
|
|
Re: Is there a trigger on deletion of objects in a module? roybond - Mon Jan 11 04:04:58 EST 2010 cidem - Fri Jan 08 13:33:09 EST 2010
First of all thanks to everyone...
Sudarshan, your suggestion was very helpful to me. My dxl is now checking the latest history session and writing the modify, delete and create object records to a text file. It has failed once but I could not find the reason, I am searching for it. The only problem left is, I did not want the records of modifying the other attributes (just need the object heading and text but they are also written as "modifyObject" type of history to the text file. I thought their history type was "modifyAttr", but I guess I was wrong. I will be working on that.
Roy, your suggestion is also worth trying I think, the problem is there are other users, and I can not control if they set show-> deletions checked all the time. My main reason for writing this dxl is to write the modified/deleted/created objects to a file when other users change a module and e-mail them to me.
You all have been vey helpful, thanks again.
Cigdem
Louie,
Ok. The information I gave was simply to let 'cidem' know that to trigger off the deletion of an object is possible, and to give him the basics off what is required, to get him started.
My own implementation is far more complex, and does not actually (now) use a trigger, and is a combination of a predefined Default View with 'Show Deletions' set, and a Layout DXL column in place of the ID column which serves to display the Object ID under certain circumstances, but also performs other tasks such as monitoring for Object Deletion by the User.
Our Schema is such that we do not allow for Object Deletion when the Object (Requirement) has also passed through a particular State in its lifecycle, which is why I then Undelete the Object, and then set its Status to indicate a Deletion was requested.
Now, as I said - my own solution is far more complicated, but my original implementation stemmed from a simple Object DXL Attribute which then fired a Trigger.
Roy.
|
|
Re: Is there a trigger on deletion of objects in a module? llandale - Mon Jan 11 08:55:46 EST 2010 roybond - Mon Jan 11 04:04:58 EST 2010
Louie,
Ok. The information I gave was simply to let 'cidem' know that to trigger off the deletion of an object is possible, and to give him the basics off what is required, to get him started.
My own implementation is far more complex, and does not actually (now) use a trigger, and is a combination of a predefined Default View with 'Show Deletions' set, and a Layout DXL column in place of the ID column which serves to display the Object ID under certain circumstances, but also performs other tasks such as monitoring for Object Deletion by the User.
Our Schema is such that we do not allow for Object Deletion when the Object (Requirement) has also passed through a particular State in its lifecycle, which is why I then Undelete the Object, and then set its Status to indicate a Deletion was requested.
Now, as I said - my own solution is far more complicated, but my original implementation stemmed from a simple Object DXL Attribute which then fired a Trigger.
Roy.
Sorry, I shouldn't have said 'your implementation', I meant I didn't understand your advise. Is this what you are advising:
[1] An attrDXL that sets the value "TRUE" when the object isDeleted, otherwise it erases the value. 'Erase' causes the attrDXL to recalculate repeatedly, specifically including when the object gets manually deleted.
[2] A pre-save-attr trigger for that attrDXL that detects a null-to-TRUE transition, and deals with undeleting and setting Object Status to 'Deleted'.
Why not just have the attrDXL itself detect a null-to-isDeleted transition, and deal with Status directly?
string ValueCurrent = obj.attrDXLName
bool IsDeleted = isDeleted(obj)
if (!IsDeleted)
{ obj.attrDXLName = ""
}
elseif(!null ValueCurrent)
{ // isDeleted and a value, keep it that way
}
elseif(obj is a qualifying mature requirement)
{ undelete(obj)
obj."Status" = "Deleted"
obj.attrDXLName = ""
}
else
{ obj.attrDXLName = "True" // isDeleted, routine object
}
|
|
Re: Is there a trigger on deletion of objects in a module? SudarshanRao - Mon Jan 11 11:29:28 EST 2010 cidem - Fri Jan 08 13:33:09 EST 2010
First of all thanks to everyone...
Sudarshan, your suggestion was very helpful to me. My dxl is now checking the latest history session and writing the modify, delete and create object records to a text file. It has failed once but I could not find the reason, I am searching for it. The only problem left is, I did not want the records of modifying the other attributes (just need the object heading and text but they are also written as "modifyObject" type of history to the text file. I thought their history type was "modifyAttr", but I guess I was wrong. I will be working on that.
Roy, your suggestion is also worth trying I think, the problem is there are other users, and I can not control if they set show-> deletions checked all the time. My main reason for writing this dxl is to write the modified/deleted/created objects to a file when other users change a module and e-mail them to me.
You all have been vey helpful, thanks again.
Cigdem
@cidem,
Yes, modifyObject will be for modification of any attributes' value. You can identify the attribute using the property "attrName". In the sample I used earlier, having an if condition - if(h.type == "modifyObject" && ((h.attrName == "Object Heading") || (h.attrName == "Object Text"))) - once session is validated, should help I guess..
modifyAttr is for modification of attribute definition.
|
|
Re: Is there a trigger on deletion of objects in a module? cidem - Tue Jan 12 04:17:24 EST 2010 SudarshanRao - Mon Jan 11 11:29:28 EST 2010
@cidem,
Yes, modifyObject will be for modification of any attributes' value. You can identify the attribute using the property "attrName". In the sample I used earlier, having an if condition - if(h.type == "modifyObject" && ((h.attrName == "Object Heading") || (h.attrName == "Object Text"))) - once session is validated, should help I guess..
modifyAttr is for modification of attribute definition.
Sudarshan,
Thank you so much, that solves the problem. I have so much to learn about DOORS:)
Regards,
Cigdem
|
|